package top.yonyong.java8.G访问接口的默认方法;

import java.util.Objects;
import java.util.function.Predicate;

/**
 * @author yonyong
 **/
public class TestPredicate {
    public static void main(String[] args) {
        Predicate<String> predicate = s -> s.length() > 0;
        System.out.println(predicate.test("666"));

        Predicate<Integer> is100 = i -> i.equals(100);
        System.out.println(is100.test(99));

        Predicate<Boolean> nonNull = Objects::nonNull;
        Predicate<Boolean> isNull = Objects::isNull;
        Predicate<String> isEmpty = String::isEmpty;
        Predicate<String> isNotEmpty = isEmpty.negate();

        System.out.println(nonNull.test(null));
        System.out.println(isNull.test(null));
        System.out.println(isEmpty.test("sss"));
        System.out.println(isNotEmpty.test(""));
    }
}
